package com.example.myshop.domain;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.myshop.entity.User;
import com.example.myshop.vo.PriorityVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface UserDao extends BaseMapper<User> {
@Select(" SELECT t_user.uid,t_user.username,t_user.user_type,t_user.level,SUM(t_product.priority) AS priorities\n" +
        "        FROM t_user\n" +
        "        LEFT JOIN t_product ON t_user.uid=t_product.business_id\n" +
        "        WHERE user_type=2 AND uid=#{uid}")
    PriorityVO getLevelByBid(@Param("uid") Long uid);
}
